// angular
//     .module('NxtMap')
//     .directive('mapSelector', mapSelector);

// function mapSelector() {
//     var directive = {
//         restrict: 'AE',
//         templateUrl: '../../templates/directive/map-selector.html'
//     };
//     return directive;
// };

var nxtApp = angular.module('NxtMap'); 
nxtApp.directive("mapSelector", function () {  
  return {  
    restrict: 'AE',  
    transclude: true,  
    // template: '<div class="selector-wrapper" ><div class="selector-header">  <div class="main-type pull-left">    <select ng-model="option.station">      <option ng-repeat="bumen in stations" value="{{bumen}}">{{bumen}}</option>    </select>  </div>  <!-- <div class="septal-line pull-right"></div> -->  <div class="pull-right">    <button class="btn btn-green" ng-click="toggleSelector()">收缩</button>  </div></div><div ng-transclude></div></div>',
    templateUrl: '../../templates/directive/selector-header.html',
    link : function(scope, element, attrs) {
      scope.isSelectorFold = true;
      scope.toggleSelector = function toggle() {
        scope.isSelectorFold = !scope.isSelectorFold;
      }
    }
  };
});

nxtApp.directive("selectorContent", function () {  
  return { 
    require: '^mapSelector', 
    restrict: 'AE',  
    transclude: true,  
    template: '<div class="selector-content" ng-class="{\'fold\': isSelectorFold}" ng-transclude></div>'
  };
});

nxtApp.directive("optionBlock", function () {  
  return { 
    require: '^selectorContent', 
    restrict: 'AE',  
    transclude: true,  
    template: '<div class="option-block" ng-transclude></div>'
  };
});
